package com.cyandpos.pad.reprintticket.reprintPresenter;


import com.cyandpos.pad.activity.ReprintTicketActivity;
import com.cyandpos.pad.posdata.QueryOrderReq;
import com.cyandpos.pad.posdata.TicketInfo;
import com.cyandpos.pad.reprintticket.IReprintView;
import com.cyandpos.pad.reprintticket.reprintModel.IReprintTicketModel;
import com.cyandpos.pad.reprintticket.reprintModel.ReprintTicketTicketModel;

/**
 * Created by pt on 2020/2/28.
 */

public class ReprintPresenterImpl implements IReprintPresenter ,ReprintTicketTicketModel.ReprintTicketDoModelListener {


    private IReprintView reprintView;
    private IReprintTicketModel reprintTicketModel;
    public ReprintPresenterImpl(IReprintView reprintView) {
        this.reprintView = reprintView;
        reprintTicketModel = new ReprintTicketTicketModel();
    }

    @Override
    public void getReprintInfo(QueryOrderReq req) {
        reprintView.showProgress();
        reprintTicketModel.askForHttp(req,this);
    }

    @Override
    public void getReprintInfo1(int flag, String wxnum, ReprintTicketActivity reprintTicketActivity) {
        reprintTicketModel.readFromlocation(flag,wxnum,reprintTicketActivity);

    }




    @Override
    public void onReprintTickeSuccess(TicketInfo ticketInfo) {
        reprintView.hideLoading();
        reprintView.showSuccess(ticketInfo);
    }

    @Override
    public void onReprintTickeFailure(String errorMsg) {
        reprintView.hideLoading();
        reprintView.showFailedError(errorMsg);
    }
}
